<?php

namespace JLPay\Models\Openmerch\Change;

use JLPay\Models\BaseRequest;

/**
 * 结算规则修改请求
 */
class SettleRuleModifyRequest extends BaseRequest
{
    public const API_URL = '/open/merch/access/settle-rule/modify';
    
    protected string $orgNo = '';  // 机构号
    protected string $merchNo = '';  // 商户号
    protected string $applyId = '';  // 申请单id
    protected string $settleMode = '';  // 结算方式
    protected string $dayCut = '';  // 营业周期，结算日切时间
    protected string $settleSession = '';  // 结算场次
    protected string $accountChangeFlag = '';  // 是否允许商户自主变更结算账户，0-否1-是
    protected string $postscript = '';  // 结算附言

    /**
     * 设置机构号
     *
     * @param string $orgNo
     * @return self
     */
    public function setOrgNo(string $orgNo): self
    {
        $this->orgNo = $orgNo;
        return $this;
    }

    /**
     * 设置商户号
     *
     * @param string $merchNo
     * @return self
     */
    public function setMerchNo(string $merchNo): self
    {
        $this->merchNo = $merchNo;
        return $this;
    }

    /**
     * 设置申请单id
     *
     * @param string $applyId
     * @return self
     */
    public function setApplyId(string $applyId): self
    {
        $this->applyId = $applyId;
        return $this;
    }

    /**
     * 设置结算方式
     *
     * @param string $settleMode
     * @return self
     */
    public function setSettleMode(string $settleMode): self
    {
        $this->settleMode = $settleMode;
        return $this;
    }

    /**
     * 设置营业周期，结算日切时间
     *
     * @param string $dayCut
     * @return self
     */
    public function setDayCut(string $dayCut): self
    {
        $this->dayCut = $dayCut;
        return $this;
    }

    /**
     * 设置结算场次
     *
     * @param string $settleSession
     * @return self
     */
    public function setSettleSession(string $settleSession): self
    {
        $this->settleSession = $settleSession;
        return $this;
    }

    /**
     * 设置是否允许商户自主变更结算账户
     *
     * @param string $accountChangeFlag
     * @return self
     */
    public function setAccountChangeFlag(string $accountChangeFlag): self
    {
        $this->accountChangeFlag = $accountChangeFlag;
        return $this;
    }

    /**
     * 设置结算附言
     *
     * @param string $postscript
     * @return self
     */
    public function setPostscript(string $postscript): self
    {
        $this->postscript = $postscript;
        return $this;
    }

    /**
     * 转换为数组
     *
     * @return array
     */
    public function toArray(): array
    {
        $data = parent::toArray();
        $data['org_no'] = $this->orgNo;
        $data['merch_no'] = $this->merchNo;
        $data['apply_id'] = $this->applyId;
        $data['settle_mode'] = $this->settleMode;
        $data['day_cut'] = $this->dayCut;
        $data['settle_session'] = $this->settleSession;
        $data['account_change_flag'] = $this->accountChangeFlag;
        $data['postscript'] = $this->postscript;
        return $data;
    }
} 